#include <stdio.h>
#include "Ballot.h"
#include "ElectionFactory.h"
#include <string>

using namespace std;

int NUM_ELECTION_DATA = 5;
string ELECTION_DATA[] = { "national President 2 Obama Romney",
						   "state NC senator 3 David Dinesh Jan",
						   "state MI senator 2 Park Hong",
						   "local NC orange dogcatcher 2 Ironman Batman",
						   "local NC durham catcatcher 2 Superman Spiderman"
						 };

Ballot* CreateBallot(string& state, string& local)
{
	Ballot* ballot = new Ballot();
	ElectionFactory factory(state, local);

	for (int i = 0; i < NUM_ELECTION_DATA; ++i)
	{
		Election* election = factory.GetElection(ELECTION_DATA[i]); 
		if( election->CanVote(state, local)) 
			ballot->AddElection(election);
		else
			delete election;
	}
	return ballot;
}

void CastVote(Ballot* ballot)
{
	ballot->print();
}

void main()
{

	string state = "NC";
	string local = "orange";
	
	Ballot* ballot = CreateBallot(state, local);
	CastVote(ballot);
}